<?php
/**
 * Hoffman Framework
 *
 * LICENSE
 *
 * This source file is subject to the GNU LGPL 2.1 license that is bundled
 * with this package in the file license.txt.
 * It is also available through the world-wide-web at this URL:
 * http://creativecommons.org/licenses/LGPL/2.1
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to annop@thaicyberpoint.com so we can send you a copy immediately.
 *
 * @package    Hoffman
 * @author     Ford AntiTrust
 * @copyright  Copyright (c) 2008 Ford AntiTrust (http://www.thaicyberpoint.com/ford/blog)
 * @since      Version Rv 0.2
 * @license    http://creativecommons.org/licenses/LGPL/2.1
 *             GNU LGPL 2.1
 * @filesource
 */

/**
 * @see Zend_Registry
 */
require_once 'Zend/Registry.php';

/**
 * @see Zend_Session
 */
require_once 'Zend/Session.php';

/**
 * Authen
 *
 * @package     Hoffman
 * @subpackage  Hmf
 * @category    Authen
 * @author      Ford AntiTrust
 * @version     SVN: $Id: Authen.php 141 2009-01-29 08:27:30Z annop.s@gmail.com $
 * @link        http://www.thaicyberpoint.com/ford/blog/hmf
 */

abstract class Hmf_Authen {

    abstract public function getInfo();

    abstract public function getRole();

    abstract public function setInfo($data);

    abstract public function setRole($role);

    abstract public function isRole($role);

    abstract public function clear();

    static function useStorage($class){

        $className = 'Hmf_Authen_Storage_' . ucfirst($class);

        if(!class_exists($className)) {
            Zend_Loader::loadClass($className);
        }

        $class = new ReflectionClass($className);

        if ($class->isSubclassOf('Hmf_Authen')) {
            return $class->newInstance();
        }

        Hmf_Errors::classNotExtends('Hmf_Authen', $className);

        return false;
    }
}
?>